<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php echo @$css.@$js;?>		
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>	
<body>
<div id="addOrder" class="win_div" style="display:block;">
<div class="win_title">添加文章<a href="javscript:;" onclick="parent.closeWin();" class="frame_close">[关闭] </a></div>
<div class="win_con">
<script type="text/javascript">
function setThumbImg(src){
	$("#thumb").val(src);
}
function checkForm()
{
	 
	var title = $.trim($("#title").val());
	var url =  $.trim($("#url").val());
	var sorts =  $.trim($("#sorts").val());
	var thumb =  $.trim($("#thumb").val());
	var description =  $.trim($("#description").val());
	

	if (title==0){	
		parent.showAlert('名称不能为空！');	
		return false;	
	}
	

	<?php 
	if ($data){
		$url = MVC_WWW_HOST.'admin/section/datamodify/do/update/id/'.$data['id'];
	}else{
		$url = MVC_WWW_HOST.'admin/section/addsectiondata/do/add/sectionid/'.$_GET['sectionid'];
	}
	?>
	var urls = '<?php echo $url;?>';
	$("#submitsectiondata").attr({"disabled":"disabled"});
	$.getJSON(urls,{'title':title,'url':url,'sorts':sorts,'thumb':thumb,'description':description},function(rs){
		if(rs.status==1){
			parent.showAlert(rs.html);		
			setTimeout(function(e){				
				parent.winreload();
			},3000);			
		}else{
			$("#submitsectiondata").attr({"disabled":""});
			parent.showAlert(rs.html);
		}
	});
	return false;
}

</script>

<form method="post" action="<?php echo MVC_WWW_HOST ?>admin/section/addsectiondata/do/add" onsubmit="return checkForm()">
<table style="line-height:35px;">
<tr>
<td>&nbsp;&nbsp;标 题 ：</td>
<td>
<input type="hidden" name="id" id="id" />
<input type="text" name="title" id="title" style="width:400px;height:18px;" value="<?php if($data) echo $data['title'];?>"> * <input type="button" value="新闻中搜索" onclick="showFrame('<?php echo MVC_WWW_HOST.'admin/api/article';?>',660,430)"></td>
</tr>
<tr>
<td>&nbsp;&nbsp;连 接：</td>
<td><input type="text" name="url" id="url" style="width:400px;height:18px;" value="<?php if($data) echo $data['url'];?>"> </td>
</tr>
<tr>
<td>&nbsp;&nbsp;排 序：</td>
<td><input type="text" name="sorts" id="sorts" style="width:50px;height:18px;" value="<?php if($data) echo $data['sorts'];?>"> </td>
</tr>
<tr>
<td>&nbsp;&nbsp;缩略图：</td>
<td><div style="width:410px;float:left;"><input type="text"  name="thumb" id="thumb" style="width:400px;" value="<?php if($data) echo $data['thumb'];?>"/></div>
		
		<?php echo flashUpload('file_upload','thumb','true');?>
		<script type="text/javascript">
			function cutimg()
			{
				var img = $.trim($("#thumb").val());
				if (img ==''){
					parent.showAlert('请先上传图片！');
					return false;
				}
				var url = '<?php echo MVC_WWW_HOST.'admin/api/cutimg?imgsrc='?>'+img;
				showFrame(url,500,420);
				
			}
		</script>
		<div style="width:70px;float:left;"><input type="button" onclick="cutimg()" value=" 编辑图片 "/></div></td>
</tr>
<tr>
<td>&nbsp;&nbsp;简 介 ：</td>
<td><textarea name="description" id="description" style="width:406px;height:122px;"><?php if($data) echo $data['description'];?></textarea></td>
</tr>
<tr><td colspan="2" align="center"><br><input id="submitsectiondata" type="submit" value="提 交"  class="submit"/></td></tr>
</table>
</form>	
</div>
</div>
<input type="hidden" id="relationid" style="width:500px;">
</body>
<script language="Javascript">
function setArticle(id,title,url,description,thumb){	
	$("#id").val(id);
	$("#title").val(title);
	$("#url").val(url);
	$("#description").val(description);
	$("#thumb").val(thumb);
}

function setThumbImg(src){
	$("#thumb").val(src);
}

</script>
</html>
